<template>
  <div>
    <el-table
      :data="tableData"
      stripe
      @selection-change="handleSelectionChange"
      style="width: 100%"
    >
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column type="index" width="50" label="序号"></el-table-column>
      <el-table-column prop="hash.carno" label="牌照"></el-table-column>
      <el-table-column prop="hash.olitime" label="加油日期"></el-table-column>
      <el-table-column prop="hash.oilsum" label="加油量"></el-table-column>
      <el-table-column prop="hash.oilamount" label="费用"></el-table-column>
      <el-table-column prop="hash.consumed" label="百公里油耗"></el-table-column>
      <el-table-column prop="hash.currentmileage" label="本次公里数"></el-table-column>
    </el-table>
    <el-pagination
      @current-change="handleCurrentChange"
      :currentPage.sync="pagobj.currentPage3"
      :pageSize="pagobj.pagesize"
      layout="total, prev, pager, next"
      :total="pagobj.total"
      style="margin:20px 0;text-align:center"
    ></el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ts: this.newStore(),
    };
  },
  props: {
    tableData: {
      type: Array,
      required: true,
    },
    pagobj: {
      type: Object,
      required: true,
    },
  },
  methods: {
    handleSelectionChange(val) {
      // console.log(val, "888");
      this.$emit('update:itemval1', val);
      if (val.length > 0) {
        const req = {
          handle: '0E56125B90D2898AB3161DCDA7D8E842F6BEA9FCE8A05B5C',
          caroilid: val[0].hash.caroilid,
        };
        this.spost(this.ts, '/mainservlet', req).then((ts) => {
          if (ts.d.sflag == 'success') {
            this.$emit('update:itemvals', ts.d.data.operation1);
            // this.branchidlist=ts.d.data.operation1[0],
            // console.log(this.branchidlist.hash.holder,'999');
          }
        });
      }

      // console.log(itemvals,'2');
      // this.$emit("update:itemvals", val);
    },
    handleCurrentChange() {
      this.$parent.getrefuellist();
    },
    handleRemove(file, fileList) {
      // console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible2 = true;
    },
  },
};
</script>

<style>
.cell {
  text-align: center;
}
</style>
